package com.pinyoumei.app.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.ShareThirdBean;
import com.pinyoumei.app.utils.DensityUtils;
import com.pinyoumei.app.utils.QRCodeUtil;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2021-08-09.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2021-08-09        Administrator             新增Person类
 * 2021-08-09        Administrator             增加sex属性
 */
public class ShareQrCodeAdapter2 extends BaseQuickAdapter<ShareThirdBean, BaseViewHolder> {
    public ShareQrCodeAdapter2(int layoutResId, @Nullable List<ShareThirdBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShareThirdBean item) {
        ImageView imageView = helper.getView(R.id.iv_bg);
        ImageView user_iv = helper.getView(R.id.user_iv);
        ImageView code_iv = helper.getView(R.id.code_iv);

        Glide.with(mContext).load(item.getImg_list()+"").into(imageView);

        Glide.with(mContext).load(item.getUser_head_img()+"").into(user_iv);

        helper.setText(R.id.user_tv,item.getUser_nick_name());
        helper.setText(R.id.code_tv,item.getRecommand_code());
        helper.setText(R.id.user_tv,item.getUser_nick_name());


        int height = DensityUtils.dip2px(mContext,100);
        int widght = DensityUtils.dip2px(mContext,100);
        code_iv.setImageBitmap(QRCodeUtil.createQRImage(item.getQr_code_url(),widght,height,null,null));

    }
}
